//
//  ST_AICenterPeculiarityDetailCell.swift
//  btvideo
//
//  Created by mac on 2020/1/10.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SnapKit
import SwifterSwift



class ST_AICenterPeculiarityDetailCell: UICollectionViewCell {

    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.backgroundColor = Color.white
        contentView.addSubview(images_container_view)
        contentView.addSubview(regimentation_label)
        contentView.addSubview(regimentation_sub_label)
        
        images_container_view.snp.makeConstraints { (make) in
            make.height.equalTo(200)
            make.left.equalToSuperview().offset(0)
            make.right.equalToSuperview().offset(0)
            make.top.equalToSuperview()
        }
        
        regimentation_label.snp.makeConstraints { (make) in
            make.left.equalTo(regimentation_sub_label)
            make.top.equalTo(images_container_view.snp.bottom).offset(10)
        }
        
        regimentation_sub_label.snp.makeConstraints { (make) in
            make.top.equalTo(regimentation_label.snp.bottom).offset(2)
            make.left.equalToSuperview().offset(5)
        }
        
        contentView.addSubview(display_number_image_view)
        contentView.addSubview(follow_number_image_view)
        contentView.addSubview(follow_number_label)
        contentView.addSubview(display_number_label)
        
        follow_number_label.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-5)
            make.centerY.equalTo(regimentation_label).offset(1)
        }
        
        follow_number_image_view.snp.makeConstraints { (make) in
            make.centerY.equalTo(follow_number_label)
            make.right.equalTo(follow_number_label.snp.left).offset(-3)
            make.width.height.equalTo(18)
        }
        
        display_number_label.snp.makeConstraints { (make) in
            
            make.right.equalTo(follow_number_image_view.snp.left).offset(-10)
            make.centerY.equalTo(follow_number_label)
        }
        
        display_number_image_view.snp.makeConstraints { (make) in
            make.centerY.equalTo(follow_number_label)
            make.right.equalTo(display_number_label.snp.left).offset(-3)
            make.width.height.equalTo(18)
        }
        
        
        
        
        
//        contentView.backgroundColor = Color.random
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
//        MARK:-Properties
//    lazy var bottom_view:UIView = {
//        let control = UIView()
////        control.cornerRadius = 10
//        control.backgroundColor = Color.white
//        return control
//    }()
    
    lazy var images_container_view:UIView = {
       let control = UIView()
        control.cornerRadius = 20
        return control
    }()
    
    lazy var regimentation_label:UILabel = {
        let control = UILabel.init()
//        control.numberOfLines = 0
        control.textColor = Color.init(hexString: "#333333")
        control.font = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.semibold)
        return control
    }()
    
    lazy var regimentation_sub_label:UILabel = {
        let control = UILabel.init()
        control.text = "  "
        control.textColor = Color.init(hexString: "#ACB4C0")
        control.font = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.regular)
        return control
    }()
    
    fileprivate lazy var follow_number_label:UILabel = {
        let control = UILabel.init()
        control.text = ""
        control.textColor = Color.init(hexString: "#ACB4C0")
        control.font = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.regular)
        return control
    }()

    fileprivate lazy var follow_number_image_view:UIImageView = {
        let control = UIImageView()
        control.image = ST_ImageUtils.imageName("个人中心_cell_收藏_icon")
        return control
    }()
    
    
    fileprivate lazy var display_number_label:UILabel = {
        let control = UILabel.init()
        control.text = ""
        control.textColor = Color.init(hexString: "#ACB4C0")
        control.font = UIFont.systemFont(ofSize: 12, weight: UIFont.Weight.regular)
        return control
    }()

    fileprivate lazy var display_number_image_view:UIImageView = {
        let control = UIImageView()
        control.image = ST_ImageUtils.imageName("个人中心_cell_展示_icon")
        return control
    }()

//    lazy var icon_image_view:UIImageView = {
//        let control = UIImageView()
//        control.contentMode = UIView.ContentMode.scaleAspectFill
//        control.cornerRadius = 10
//        return control
//    }()

    //    MARK:- Bind Model
    var model = ST_PairsPeculiarity(){
        didSet{
            bind_model_view()
        }
    }
    
    func bind_model_view(){
        
//        icon_image_view.pin_setImage(from: model.image.url, completed: nil)
        
        regimentation_label.text = model.name
        
        regimentation_sub_label.text = model.remark
        
        display_number_label.text = model.view_count.st_number_description()
        
        follow_number_label.text = model.thumb_up_count.st_number_description()
    }
}
